<template>
  <!--查看学生信息-->
    <div class="components_table_details">
        <el-dialog width="1000px" title="职业发展活动详情"  :visible.sync="state" :show-close="true" :close-on-click-modal="false" class="maxheight">
          <table class="el-table el-table--fit el-table--striped el-table--border el-table--enable-row-transition ">
            <tbody class="el-table__body">
              <tr>
                <td width="130px"><label>学校：</label></td>
                <td width="300px">{{ruleForm.schoolName}}</td>
                <td width="130px"><label>学院：</label></td>
                <td width="300px">{{ruleForm.secondSchoolName}}</td>
                <td width="130px"><label>专业：</label></td>
                <td width="300px">{{ruleForm.professionName}}</td>
              </tr>

              <tr>
                <td><label>班级：</label></td>
                <td colspan="3">
                  <span v-for="(className,index) in classNameArr" :key="className.id">
                  {{className.text}}
                  </span>
                </td>
                <td><label>学期：</label></td>
                <td>{{ruleForm.semester}}</td>
              </tr>
              <tr>
                <td><label>职业发展计划：</label></td>
                <td colspan="5">{{ruleForm.semester+ruleForm.schoolName+ruleForm.secondSchoolName+ruleForm.professionName}}</td>
              </tr>

              <tr>
                <td><label>职业发展周次：</label></td>
                <td>{{weekPlanName}}</td>
                <td><label>活动类型：</label></td>
                <td>{{ruleForm.type}}</td>
                <td><label>活动地点：</label></td>
                <td>{{ruleForm.actSite}}</td>

              </tr>

              <tr>
                <td><label>活动日期：</label></td>
                <td>{{ruleForm.actData}}</td>
                <td><label>活动时间：</label></td>
                <td>{{ruleForm.actTime}}</td>
                <td width="130px"><label>会议主持人：</label></td>
                <td width="300px">{{ruleForm.compere}}</td>
              </tr>
              <tr>



                <td><label>记录人：</label></td>
                <td>{{ruleForm.recorder}}</td>
                <td><label>主题：</label></td>
                <td>{{ruleForm.subject}}</td>
                <td><label>参会人员：</label></td>
                <td>{{ruleForm.attendee}}</td>


              </tr>

              <tr>
                <td><label>缺席人员：</label></td>
                <td colspan="5">{{ruleForm.absentee}}</td>
              </tr>

              <tr>
                <td><label>活动内容：</label></td>
                <td>{{ruleForm.content}}</td>

                <td><label>活动决议：</label></td>
                <td colspan="3">{{ruleForm.result}}</td>



              </tr>
              <tr>
                <td><label>信息：</label></td>
                <td colspan="5">
                  <span v-for="(className,index) in ruleForm.attachment" :key="className.id">
                  {{className.fileRealName}}
                  </span>
                </td>
              </tr>
            </tbody>
          </table>
          <div slot="footer" class="dialog-footer">
                <el-button @click="state = false"  size="mini">关 闭</el-button>
            </div>
        </el-dialog>
        <!-- 内容区域  结束 -->
        </div>
</template>
<script>
  import moment from 'moment'
  export default {
    data() {
      return {
        state:false,
        classNameArr:[],
        weekPlanName:null,
        ruleForm:{
          schoolId:null,
          secondSchoolId:null,
          professionId:null,
          classId:null,
          semester:null,
          compere:null,
          planId:null,
          detailId:null,
          type:null,
          actTime:null,
          actSite:null,
          subject:null,
          attendee:null,
          absentee:null,
          content:null,
          result:null,
          recorder:null
        }
      };
    },
    created(){
    },
    methods: {
      showDialog(item){
        let self = this;
        self.state = true;
        self.ruleForm = item;
        self.classNameArr = [];
        self.weekPlanName = null;
        //获取详情
        self.getruleForm(item,
          (result)=>{
            self.ruleForm.absentee = result.absentee;
            self.ruleForm.actDate = result.actDate;
            self.ruleForm.actSite = result.actSite;
            self.ruleForm.actTime = result.actTime;
            self.ruleForm.attachment = result.attachment;
            self.ruleForm.attendee = result.attendee;
            self.ruleForm.classId = result.classId;
            self.ruleForm.compere = result.compere;
            self.ruleForm.content = result.content;
            self.ruleForm.createBy = result.createBy;
            self.ruleForm.detailId = result.detailId;
            self.ruleForm.id = result.id;
            self.ruleForm.planId = result.planId;
            self.ruleForm.professionId = result.professionId;
            self.ruleForm.recorder = result.recorder;
            self.ruleForm.schoolId = result.schoolId;
            self.ruleForm.secondSchoolId = result.secondSchoolId;
            self.ruleForm.semester = result.semester;
            self.ruleForm.subject = result.subject;
            self.ruleForm.type = result.type;


            // 请求班级
            self.getClassList(self.ruleForm.schoolId,self.ruleForm.secondSchoolId,self.ruleForm.professionId);
            // 职业发展周次
            self.getweekPlan();
          });
      },
      getruleForm(item,success){
        let self = this;
        self.axios(api.getCareerDevelopmentById+item.id)
          .then(function(response){
                success(response.data.data)
          });
      },
      //获取筛选后的班级
      getClassList(schoolId,secondSchoolId,professionId){
          let vm = this;
          vm.axios.get(api.getClassList, {
               params: {
                  schoolId: schoolId,
                  secondSchoolId: secondSchoolId,
                  professionId:professionId
              }
          }).then((response) => {
              if (response.data.success) {
                  vm.classList = JSON.parse(JSON.stringify(response.data.data));
                  for (var i = 0; i < vm.ruleForm.classId.length; i++) {
                    let className = _.filter(vm.classList, function(o) { return o.id == vm.ruleForm.classId[i]; });
                    vm.classNameArr.push(className[0]);
                  };
              } else {
                  vm.$message.error(response.data.msg);
              }
          })
      },
      //获得职业发展计划
      getweekPlan(){
        let self = this;
        self.axios({
            method:"put",
            url:api.careerPlan.queryCareedevePlanListByBaseId+self.ruleForm.planId,
          }).then(function(response){
            self.weekPlanData  = response.data.data;
            let weekPlan = _.filter(self.weekPlanData, function(o) { return o.id == self.ruleForm.detailId; });
            self.weekPlanName = '第'+weekPlan[0].teachWeek+'周-'+weekPlan[0].supportPoint;
          });
      }

    }
  }
</script>

<style scoped>

</style>
